#include "dialogslaveparamread.h"
#include "ui_dialogslaveparamread.h"

DialogSlaveParamRead::DialogSlaveParamRead(QWidget *parent, const QString &ctx) :
        QDialog(parent),
        ui(new Ui::DialogSlaveParamRead)
{
    ui->setupUi(this);
    numberkeyboard = new DialogVKB(this);
    ui->lineEdit->setText(ctx);

    //将所有lineedit信号都和软件盘界面显示关联
    connect(ui->lineEdit, &VKB_lineEdit::send_show, this, &DialogSlaveParamRead::show_numberkeyboard_ui);
    connect(numberkeyboard, &DialogVKB::sendMessage, this, &DialogSlaveParamRead::confirmString);
}

DialogSlaveParamRead::~DialogSlaveParamRead()
{
    delete ui;
}

int DialogSlaveParamRead::getInputValue()
{
    return ui->lineEdit->text().toInt();
}

void DialogSlaveParamRead::show_numberkeyboard_ui(const QString &data)
{
    lineEdit_object = sender()->objectName();//获得调用软件盘的部件的名称
    numberkeyboard->setInputdata(data);
    numberkeyboard->show();
}

void DialogSlaveParamRead::confirmString(const QString &gemfield)
{
    //判断应该将信息写入哪一个输入框
    if (lineEdit_object == ui->lineEdit->objectName())
    {
        ui->lineEdit->setText(gemfield);
    }
}

